export function compareObject(firstObject, secondObject) {
  let firstProps = Object.getOwnPropertyNames(firstObject);
  let secondProps = Object.getOwnPropertyNames(secondObject);
  if (firstProps.length !== secondProps.length) {
    return false;
  }
  for (let i = 0; i < firstProps.length; i++) {
    let propName = firstProps[i];
    if (firstObject[propName] !== secondObject[propName]) {
      return false;
    }
  }
  return true;
}

//对象数组去重
export const objListUnique = (list) => {
  let obj = {};
  list = list.reduce((newArr, next) => {
    obj[next.id] ? "" : (obj[next.id] = true && newArr.push(next));
    return newArr;
  }, []);
  return list;
}

export const randomString = (len) => {
  len = len || 32;
  const t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",
    a = t.length;
  let n = "";
  for (let i = 0; i < len; i++) n += t.charAt(Math.floor(Math.random() * a));
  return n
}

export const compress = () => {

}
